package com.xique.door.project.miniprogram.controller;

import com.xique.common.core.web.controller.BaseController;
import com.xique.common.core.web.domain.AjaxResult;
import com.xique.door.project.miniprogram.bean.request.MiniOpenDoorRecordRequest;
import com.xique.door.project.miniprogram.bean.request.MiniOpenDoorRequest;
import com.xique.door.project.miniprogram.biz.service.IMiniDoorBizService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @author shd
 * @create 2022/4/20 13:22
 */
@RestController
@RequestMapping("/door")
public class MiniDoorController extends BaseController {

    @Autowired
    private IMiniDoorBizService doorBizService;

    @GetMapping("/getHouseDeviceList")
    public AjaxResult getHouseDeviceList() {
        return doorBizService.getHouseDeviceList();
    }

    @PostMapping("/openDoor")
    public AjaxResult openDoor(@RequestBody @Valid MiniOpenDoorRequest request) {
        return doorBizService.openDoor(request);
    }

    @GetMapping("/openDoorRecord")
    public AjaxResult openDoorRecord(@Valid MiniOpenDoorRecordRequest request) {
        return doorBizService.getOpenDoorRecord(request);
    }
}
